package models

import (
	"CMETO/utils"
	"time"
)

// 交易记录表
type AccounRecode struct {
	// 记录Id
	Id int `json:"id" gorm:"column:id;type:int;auto_increment;primary_key;"`
	// 账户Id
	AccountId int `json:"account_id" gorm:"column:account_id;type:int;"`
	// 交易余额
	Amount string `json:"amount" gorm:"column:amount;type:varchar(50);"`
	// 状态 0：增加，1：减少
	Status int `json:"status" gorm:"column:status;type:int;"`
	// 交易时间
	CreateTime string `json:"create_time" gorm:"column:create_time;type:varchar(30);"`
	// 是否删除
	IsDelete int `json:"is_delete" gorm:"column:is_delete;type:int;"`
}

// 插入一批账户数据
func InsertMockAccountRecode() {
	DB.Model(&AccounRecode{}).Create([]AccounRecode{
		{Id: 1, AccountId: 1, Amount: "100.00", Status: 0, CreateTime: utils.TimeFormatter(time.Now()), IsDelete: 0},
		{Id: 2, AccountId: 2, Amount: "100.00", Status: 1, CreateTime: utils.TimeFormatter(time.Now()), IsDelete: 0},
	})
}
